package common.packets;



/**
 * Handles user logging in
 * Requires userName and Password ( may be empty )
 * @author  mickek
 * 
 */
public class LoginPacket extends Packet {
	
	public static final String PREFIX = "login";
	
	private String userName;
	private String password;

	public LoginPacket( String _userName, String _password ) {
		userName = _userName;
		password = _password;
	}
	
	/**
	 * @return
	 * @uml.property  name="password"
	 */
	public String getPassword(){
		return password;
	}
	
	public String getLogin(){
		return userName;
	}

	@Override
	public byte[] serialize() {

		return (PREFIX + Packet.DELIMITER + userName + Packet.DELIMITER + password + Packet.DELIMITER + Packet.NEW_LINE).getBytes();
	}

	@Override
	public String toString() {
		return PREFIX;
	}

}
